<template>
  <div
    class="cardContain"
    :style="{
      paddingBottom: tempData.paddingBottom + 'px',
      paddingLeft: tempData.paddingTwice + 'px',
      paddingRight: tempData.paddingTwice + 'px',
      paddingTop: tempData.paddingTop + 'px',
      boxSizing: 'border-box',
    }"
  >
    <div
      class="cardContainer"
      :style="
        tempData.showType == 1
          ? {
              borderTopLeftRadius: tempData.radiusNumTop + 'px',
              borderTopRightRadius: tempData.radiusNumTop + 'px',
              borderBottomLeftRadius: tempData.radiusNumBottom + 'px',
              borderBottomRightRadius: tempData.radiusNumBottom + 'px',
              backgroundColor: tempData.boxBg,
            }
          : {
              borderTopLeftRadius: tempData.radiusNumTop + 'px',
              borderTopRightRadius: tempData.radiusNumTop + 'px',
              borderBottomLeftRadius: tempData.radiusNumBottom + 'px',
              borderBottomRightRadius: tempData.radiusNumBottom + 'px',
              backgroundImage: 'url(' + tempData.bgImage + ')',
              backgroundSize: '100% 100%',
            }
      "
    >
      <div class="lefts">
        <img class="yysImg" src="@/assets/didaima/yys.png" alt="" />
        <div>
          <p class="nums" :style="{ color: tempData.textColor }">充值号：8986123456789</p>
          <p class="times">到期时间：2025-02-24 17:44:43</p>
        </div>
      </div>
      <div class="rights">
        <img
          class="img1"
          :src="
            tempData.reloadImageUrl ? tempData.reloadImageUrl : '/src/assets/didaima/reload.png'
          "
          alt=""
        />
        <img
          class="img2"
          :src="tempData.outmageUrl ? tempData.outmageUrl : '/src/assets/didaima/out.png'"
          alt=""
        />
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
  import { watch, ref } from 'vue'
  const props = defineProps({
    // 选中的当前组件参数
    compObj: {
      type: Object,
      default: () => {
        return {}
      },
    },
  })
  const tempData: any = ref({})
  watch(
    () => props.compObj,
    (newVal, oldVal) => {
      tempData.value = JSON.parse(JSON.stringify(newVal))
    },
    { immediate: true, deep: true }
  )
</script>

<style scoped lang="less">
  .cardContain {
    width: 100%;
  }
  .cardContainer {
    display: flex;
    width: 100%;
    justify-content: space-between;
    align-items: center;
    padding: 15px 10px;

    .lefts {
      display: flex;
      justify-content: space-between;
      align-items: center;
      .yysImg {
        width: 35px;
        height: 35px;
        margin-right: 7px;
      }
      .nums {
        font-size: 15px;
        color: #1d2129;
      }
      .times {
        font-size: 12px;
        color: #1d2129;
      }
    }
    .rights {
      display: flex;
      justify-content: space-between;
      align-items: center;
      .img1 {
        width: 20px;
        height: 20px;
        margin-right: 15px;
      }
      .img2 {
        width: 20px;
        height: 20px;
      }
    }
  }
</style>
